<template>
  <div class="car-manage">
    <!--    <a-button type="primary">新增<a-icon type="plus" /></a-button>-->
    <common-table
      ref="table"
      :fetch="getDataAsync"
      :fetch-params="apiParams"
      :show-toolbar="false"
      :columns="columns"
      @vue:mounted="() => $refs.table.load()"
      style="width: 100%; height: 100%"
    >
      <template #index="{ index }">
        <span>{{ index + 1 }}</span>
      </template>
      <template #action="{ scope }">
        <span style="font-size: 14px; color: #62b8b1; cursor: pointer" @click="details(scope)">详情</span>
      </template>
    </common-table>
  </div>
</template>

<script>
import CommonTable from '@gis/lib/components/vex-table/index.vue';
export default {
  name: 'car-manage',
  components: { CommonTable },
  props: {
    data: { type: Object, default: () => ({}) },
  },
  data() {
    return {
      columns: [
        {
          title: '车辆全图',
          dataIndex: 'car_all_img_url',
          ellipsis: true,
        },
        {
          title: '车牌号',
          dataIndex: 'license_plate_number',
          ellipsis: true,
        },
        {
          title: '车辆类型',
          dataIndex: 'type_code',
          ellipsis: true,
        },
        {
          title: '车主电话',
          dataIndex: 'linkman_phone',
          ellipsis: true,
        },
        {
          title: '品牌',
          dataIndex: 'brand',
          ellipsis: true,
        },
        {
          title: '登记时间',
          dataIndex: 'create_time',
          ellipsis: true,
        },
        /*{
          title: '操作',
          dataIndex: 'action',
          scopedSlots: { customRender: 'action' },
        },*/
      ],
    };
  },
  computed: {
    apiParams() {
      return {
        people_id: this.data.people_id,
        belong_type: 2,
      };
    },
  },
  methods: {
    async getDataAsync(params) {
      const res = await this.$axios.get('/xw-microservice/xw-command-dispatch/v3/zz/car/page', {
        params,
      });
      const data = res.data || {};
      return { data: data.list, total: data.count };
    },
    details() {},
  },
};
</script>

<style scoped lang="less">
.car-manage {
  width: 100%;
  height: 100%;
}
</style>
